package com.power.sifa.netlogin.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.plf.core.common.annotations.FieldEnumText;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
*  申诉端登录用户实体实体类
*/

@Entity
@ApiModel(value="申诉端登录用户实体")
@Data
@Table(name="Net_user",schema="sfapprove")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
//@IdClass(Net_user.Net_userPK.class) 用于复合组件
public class Net_user extends BaseModel implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
    @Id
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "用户id")
    private String userid;

    @ApiModelProperty(value = "用户名称")
    private String username;

    @ApiModelProperty(value = "用户全称")
    private String fullname;

    @ApiModelProperty(value = "身份证号")
    private String cardno;

    @ApiModelProperty(value = "密码")
    private String password;

    @ApiModelProperty(value = "性别")
    private Integer gender;

    @ApiModelProperty(value = "身份证正面")
    private String cardfront;

    @ApiModelProperty(value = "身份证国徽面")
    private String cardback;

    @ApiModelProperty(value = "头像")
    private String avatar;

    @ApiModelProperty(value = "电话")
    private String phone;

    @ApiModelProperty(value = "邮件")
    private String email;

    @ApiModelProperty(value = "删除标志")
    private Integer deleted;

    @ApiModelProperty(value = "过期时间", example="2020-10-22 10:03:22")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date expiredate;

    /**
     *  性别文本
     */
    @Transient
    @FieldEnumText(eum="Tp_gender", valuefield="gender")
    private String gender_text;


    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("userid", this.getUserid());
        map.put("username", this.getUsername());
        map.put("fullname", this.getFullname());
        map.put("cardno", this.getCardno());
        map.put("password", this.getPassword());
        map.put("gender_text", this.gender_text);
        map.put("gender", this.getGender());
        map.put("cardfront", this.getCardfront());
        map.put("cardback", this.getCardback());
        map.put("avatar", this.getAvatar());
        map.put("phone", this.getPhone());
        map.put("email", this.getEmail());
        map.put("deleted", this.getDeleted());
        map.put("expiredate", this.getExpiredate());
        return map;
    }

    public String getUserid() {
        return userid;
    }

    public void setUserid(Serializable userid) {
        this.userid = (String) userid;
    }

    @Override
    public Serializable getId() {
        return null;
    }

    @Override
    public void setId(Serializable id) {

    }

    public Serializable getPrimaryKey() {
        return userid;
        // return new Net_userPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.userid = (String)key;

        //Net_userPK pk = (Net_userPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}